import Vue from 'vue'
import Router from 'vue-router';


Vue.use(Router)

/* Layout */
import Layout from '@/views/layout/Layout'

const spr = r => require.ensure([], () => r(require('@/views/spr')), 'spr')
const login = r => require.ensure([], () => r(require('@/views/login')), 'login');
const ration = r => require.ensure([], () => r(require('@/views/ration')), 'ration');
const testList = r => require.ensure([], () => r(require('@/views/testList')), 'testList');
const userDetailList = r => require.ensure([], () => r(require('@/views/userDetailList')), 'userDetailList');

export const constantRouterMap = [{
    path: '/login',
    component: login,
    hidden: true
}, {
    path: '/spr',
    component: spr,
    redirect: '/spr',
    children: [{
        path: '/spr',
        meta: {
            title: '首页',
            icon: 'setting',
            keepAlive: true
        },
    }]
}, {
    path: '/',
    component: ration,
    hidden: true,
    children: [{
        path: '/ration',
        meta: {
            title: '蛋白质',
            icon: 'setting',
        },
    }]
}, {
    path: '/testList',
    component: Layout,
    hidden: true,
    children: [{
        path: '/testList',
        component: testList,
        meta: {
            title: '用户历史'
        },
    }]
}]

/* 初始路由 */
export default new Router({
    // mode: 'history', //后端支持可开
    scrollBehavior: () => ({
        y: 0
    }),
    routes: constantRouterMap
})

export const asyncRouterMap = []



export const allRoutes = []